#include <stdio.h>

// 输入运算符
void fun1()
{
    char operato = '0';
    printf("请输入运算符：");
    scanf("\n%c", &operato);
    printf("您输入的操作符是：%c", operato);

    int a = 0, b = 0;
    printf("请输入两个整数用逗号分隔：");
    scanf("%d,%d", &a, &b);

    switch (operato)
    {
    case '+':
        printf("%d \n", a + b);
        break;
    case '-':
        printf("%d \n", a - b);
        break;
    case '*':
        printf("%d \n", a * b);
        break;
    case '/':
        if (b == 0)
            printf("除数不能为0");
        else
            printf("%d \n", a / b);
        break;
    case '%':
        if (b == 0)
            printf("除数不能为0");
        else
            printf("%d \n", a % b);
        break;
    default:
        printf("操作符不合法");
    }
}
// 判断质数
void fun2()
{
    int num = 0;
    scanf("%d", &num);

    int n = 0;
    int i = 1;
    while (i < num)
    {
        i++;
        if (num % i == 0)
        {
            n++;
        }
    }

    if (n > 0)
    {
        printf("不是质数\n");
    }
    else
    {
        printf("是质数\n");
    }
}
// 鸡兔同笼的问题：鸡兔同笼: 共88个头，244只脚，鸡兔各多少只
void fun3()
{
    int chicken = 0;
    int rabbit = 0;
    for (int chicken = 0; chicken <= 88; chicken++)
    {
        rabbit = 88 - chicken;
        if (rabbit * 4 + chicken * 2 == 244)
        {
            printf("兔子可以买：%d只，鸡可以买：%d只", chicken, rabbit); // 兔子可以买：54只，鸡可以买：34只
        }
    }
}
// 百元买百鸡：求每种鸡各多少只(母鸡三元一只，公鸡五元一只，小鸡一元三只)
void fun4()
{
    int hen = 0;
    int cock = 0;
    int chick = 0;
    int total = 100;
    for (hen = 0; hen < total; hen++)
    {
        for (cock = 0; cock < total - hen; cock++)
        {
            chick = total - hen - cock;
            if (hen * 3 + cock * 5 + chick / 3.0 == 100)
            {
                printf("母鸡能买：%d只，小鸡能买：%d只，公鸡能买：%d只\n", hen, chick, cock);
            }
        }
    }
    // 算法二：嵌套循环每种鸡的最多可买只数
}
int main()
{
    float sum = 0;
    for (int i = 1; i < 100; i++)
    {
        sum = sum + 1.0 / i;
    }

    printf("%d", 0 == 0.00001f);
    return 0;
}